<template>
  <el-dialog class="pick-dialog" title="提号备注" :visible.sync="dialogVisible" :close-on-click-modal="false" width="700px"
    top="30vh">
    <div class="form-box" v-loading="loading">
      <el-form ref="ruleForm" :rules="rules" :model="ruleForm" label-width="auto">
      
        <el-form-item label="提号备注" prop="remake">
          <el-input type="textarea" :rows="4" v-model="ruleForm.remake" placeholder="请输入提号备注" style="width:500px" />
        </el-form-item>
        <div class="center">
          <el-button @click="close()">取消</el-button>
          <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
        </div>
      </el-form>
    </div>
  </el-dialog>
</template>

<script>
import goodsListApi from "../../../api/gameConfig/goodsList";
export default {
  name: "pick",
  data() {
    return {
      dialogVisible: false,
      info: "",
      ruleForm: {
        remake: null,//beizhu
        id: ''
      },
      loading: false,
      rules:{
       
      } 
    };
  },
  methods: {
    open(flag, data) {
      if (flag == 'edit') {
        this.ruleForm = {...data}
      }
      this.dialogVisible = true;
    },
    close() {
      this.resetForm()
      this.dialogVisible = false;
    },
    submitForm(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          console.log("%c Line:97 🍌 ruleForm", "color:#e41a6a", this.ruleForm);
          this.loading = true
          goodsListApi.updateRemake(this.ruleForm).then(res => {
            this.dialogVisible = false
            this.loading = false
            if (res.code == 200) {
              // console.log("%c Line:108 🍆 res", "color:#ffdd4d", res);
              this.$message.success(res.msg);
              this.$parent.getList()
              this.resetForm()
            } else {
              this.$message({
                type: 'error',
                message: res.msg
              })
            }
          })
        } else {
          console.log("error submit!!");
          return false;
        }
      })
    },
    resetForm() {
      this.$refs['ruleForm'].resetFields();
    },


  }
};
</script>
<style scoped lang="css">
.center {
  text-align: center;
}

.pick-dialog>>>.el-dialog {
  margin-top: 100px !important;
}

.form-box {
  max-height: 800px;
  overflow-y: auto;
}

::v-deep .el-input-number.is-without-controls .el-input__inner {
  text-align: left;
}

.form-box>>>.el-upload-dragger {
  width: 148px;
  height: 148px;
}
</style>
